# 引入请求包
import urllib.request
import re
try:
    url = "http://127.0.0.1:5000/"  # 请求地址
    resp = urllib.request.urlopen(url=url)  # 发起请求
    data = resp.read()  # 读取数据
    html = data.decode("utf-8")  # 编码方式
    # print(html)     # 打印

    # 查找数据
    m = re.search(r"<tr>", html)
    n = re.search(r"</tr>", html)

    while m != None and n != None:
        row = html[m.end():n.start()]
        # print(row)
        a = re.search(r"<td>", row)
        b = re.search(r"</td>", row)

        while a != None and b != None:
            s = row[a.end():b.start()]
            print(s, end=' ')
            row = row[b.end():]
            a = re.search(r"<td>", row)
            b = re.search(r"</td>", row)
        print()
        html = html[n.end():]
        m = re.search(r"<tr>", html)
        n = re.search(r"</tr>", html)
except Exception as err:
    print(err)




